<!doctype html>
<title>For loop</title>

<script>

//Display "Hello world!" 5 times

console.log("--- Hello World ---");

for(var i = 0; i < 5; i++)
{
  console.log("Hello world!");
}

//Count from 0 to 4

console.log("--- 0 to 4 ---");

for(var i = 0; i < 5; i++)
{
  console.log(i);
}

//Count from 1 to 5

console.log("--- 1 to 5 ---");

for(var i = 1; i <= 5; i++)
{
  console.log(i);
}

</script>